<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateNdMasterDomainTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('nd_master_domain', function(Blueprint $table) {
            $table->increments('id');                                   // ドメインID
            $table->string('name', 120);                                // 名称
            $table->string('name2', 120)->nullable();                   // 名称2
            $table->string('code', 8)->nullable();                      // コード
            $table->integer('node_parent')->nullable();
            $table->integer('node_left');
            $table->integer('node_right');
            $table->integer('node_depth')->nullable();
            $table->integer('node_flag')->nullable();
            $table->index( array('node_parent'));
            $table->index( array('node_left'));
            $table->index( array('node_right'));
            $table->index( array('node_depth'));
            $table->timestamps();
            $table->softDeletes();
            $table->index( array('name'));
            $table->index( array('code'));
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('nd_master_domain');
    }
}
